﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CameraParentClassLibrary
{
    /// <summary>
    /// 相机工作状态
    /// </summary>
    public enum CamerWork
    {
        None,//等待
        采集一张,//采集一张
        连续采集,//采集多张
    }

    public abstract class CameraParent
    {
        /// <summary>
        /// 相机品牌
        /// </summary>
        public string BrandName { get; set; }
        /// <summary>
        /// 相机名称
        /// </summary>
        public string CameraName { get; set; }

        /// <summary>
        /// 相机的工作状态
        /// </summary>
        public CamerWork CameraWorkState { get; set; } = CamerWork.None;//等待
        /// <summary>
        /// 相机读取图片后的延迟时间
        /// </summary>
        public abstract int DelayTime { get; set; }

        /// <summary>
        /// 设置显示内容
        /// </summary>
        public Action<string> SetLabelText;
        /// <summary>
        /// 是否显示按钮(底部四个按钮)
        /// </summary>
        public Action<bool> isShowBtn;

        /// <summary>
        /// 打开相机后触发(界面响应)
        /// </summary>
        public event Action OpenCameraEvent;
        /// <summary>
        /// 关闭相机后触发(界面响应)
        /// </summary>
        public event Action CloseCameraEvent;

        /// <summary>
        /// 打开相机
        /// </summary>
        public virtual void OpenCamera() 
        { 
            OpenCameraEvent?.Invoke();
            CameraWorkState = CamerWork.None;
        }
        /// <summary>
        /// 关闭相机
        /// </summary>
        public virtual void CloseCamera()
        {
            CloseCameraEvent?.Invoke();
            CameraWorkState = CamerWork.None;
        } 
        /// <summary>
        /// 采集一张图片
        /// </summary>
        public virtual void CollectOne() 
        {
            CameraWorkState = CamerWork.采集一张;
        }
        /// <summary>
        /// 连续采集图片
        /// </summary>
        public virtual void CollectOneContinuous() 
        {
            CameraWorkState = CamerWork.连续采集;
        }


    }
}
